<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>广告窗管理</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link rel="stylesheet" type="text/css" href="css/show_ad.css">
<script type="text/javascript">
		function add_ad(){
			window.location.href="add_ad.jsp";
		}
	
		<%int i=1; %>
		function delect_ad(){
			for(var i=1;i<=<%=i%>;i++){
				var adObj=document.getElementById("ad_id<%=i%>");
				if(adObj.checked){
					var bol=confirm("确定删除");
					if(bol==true){
						window.location.href="delete_ad.do?id="+adObj.value;
						alert("删除成功");
					}
				}else{
					alert("没有选中广告组，请选择");
				}
			}
		
		} 
		function look_img(){
			for(var i=1;i<=<%=i%>;i++){
				var adObj=document.getElementById("ad_id<%=i%>");
				if(adObj.checked){
				
					window.location.href="look_ad.do?id="+adObj.value;
					
				}else{
					alert("没有选中广告组，请选择");
				}
			}
		
		
		}
		
		function start(){
		
			for(var i=1;i<=<%=i%>;i++){
				var adObj=document.getElementById("ad_id<%=i%>");
				if(adObj.checked){
					var bol=confirm("确定设置为广告");
					if(bol==true){
						window.location.href="start_ad.do?id="+adObj.value;
						alert("设置成功");
					}
				}else{
					alert("没有选中广告组，请选择");
				}
			}
		
		}
	</script>

</head>

<body>
	<div class="div_all">

		<%-- <div class="div_1">
				<div style="position: absolute;">
				
			<!--判断是否登录  -->
			<c:if test="${username1!=null}">
				<span style="color:red;">用户名: ${username1}</span>
			</c:if>
			<c:if test="${username1==null}">
				<a href="qiehuanUser.do" style="text-decoration: none;color:red;">亲，请登录</a>
			</c:if></div>
			
			<!-- 
			<div class="div_menu">
				<a href="add_goods_showtype.do" class="a_menu">添加商品 </a>
  				<a href="show_goods.do" class="a_menu">查询商品 </a>
  				<a href="add_type.do" class="a_menu">类别管理 </a>
  				<a href="show_ads.do" class="a_menu">广告维护 </a>
  				<a href="zhuce.jsp" class="a_menu">注册账号 </a>
  				<a href="qiehuanUser.do" class="a_menu">切换账号 </a>
  				<a href="select_orders.do" class="a_menu">订单查询 </a>
  				<a href="go_tongji.do" class="a_menu">销售统计 </a>
			</div> -->
				

			</div>
		</div> --%>

		<div class="div_2">
			<!-- 添加div -->
			<div class="div_showad">
				<span style="color:red; font-size:35;">广告窗组查询:</span><br />
				<table class="table_class">
					<tr style="color:green;">
						<td></td>
						<td width="100px" height="40px">广告1</td>
						<td width="100px" height="40px">广告2</td>
						<td width="100px" height="40px">广告3</td>
						<td width="100px" height="40px">广告4</td>
						<td width="100px" height="40px">广告5</td>
						<td width="100px" height="40px">广告6</td> 

					</tr>

					<c:forEach items="${list}" var="ads">
						<tr>
							<td><input type="radio" value="${ads.id}" id="ad_id<%=i%>"
								name="ad_radio" /></td>
							<td>${ads.img_1}</td>
							<td>${ads.img_2}</td>
							<td>${ads.img_3}</td>
							<td>${ads.img_4}</td>
							<td>${ads.img_5}</td>
							<td>${ads.img_6}</td>

							<%i++; %>

						</tr>
					</c:forEach>
					<tr></tr>
					<tr></tr>
					<tr>
						<td><input type="button" value="设置为前台广告" onclick="start()" />
						<td>
						<td><input type="button" value="删除" onclick="delect_ad()" />
						<td>
						<td><input type="button" value="查看图片" onclick="look_img()" />
						<td>
						<td><input type="button" value="添加广告组" onclick="add_ad()" />
						<td>
					</tr>

				</table>
			</div>
		</div>
	</div>
</body>
</html>
